#include "HasScriptHandler.h"

HasScriptHandler::HasScriptHandler()
{
}

HasScriptHandler::~HasScriptHandler()
{

}

bool HasScriptHandler::addEventHandler(const std::string& aEventName, const std::string& aFileName, const std::string& aFuncName, bool aCheckExist)
{
    if(aCheckExist)
    {
        if(m_eventHandlerList.find(aEventName) != m_eventHandlerList.end())
        {
            return false;
        }
    }

    EventHandler handler = {aFileName, aFuncName};
    m_eventHandlerList[aEventName] = handler;

    return true;
}

void    HasScriptHandler::delEventHandler(const std::string& aEventName)
{
    m_eventHandlerList.erase(aEventName);
}

void    HasScriptHandler::notify(const std::string& aEventName)
{
    EventHandlerListType::iterator it = m_eventHandlerList.find(aEventName);
    if(it != m_eventHandlerList.end())
    {
        EventHandler& handler = it->second;
    }
}